﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SlimDX;

namespace GameStudio.Framework.GraphicsEngine
{
    public interface IVisualObject  
    {
        void Initilize();
        void Render();
    }
    public abstract class VisualObjectBase : IVisualObject
    {
        public VisualObjectBase()
        {
            this.Matrix = Matrix.Identity;
        }
        public Matrix Matrix { set; get; }

        public void Translate(float x, float y, float z)
        {
            this.Matrix = SlimDX.Matrix.Multiply(SlimDX.Matrix.Translation(x, y, z), this.Matrix);
        }

        public void Rotate(float x, float y, float z)
        {
            this.Matrix = SlimDX.Matrix.Multiply(SlimDX.Matrix.RotationYawPitchRoll(x, y, z), this.Matrix);
        }

        public void Scale(float x, float y, float z)
        {
            this.Matrix = SlimDX.Matrix.Multiply(SlimDX.Matrix.Scaling(x, y, z), this.Matrix);
        }

        public virtual void Render()
        {
            DeviceContext.Current.Device.SetTransform(SlimDX.Direct3D9.TransformState.World, this.Matrix);
        }

        public abstract void Initilize();

        //public abstract void Initilizeabs();
    }
}
